<template>
	<view>
		<!-- 测试提交后 -->
		<view class="headbgc"></view>
		<view class="mainpadding2 contentmsg">
			<view class="mainpadding_top topradius textcenter hei_text bold">{{dataAll.name}}</view>
			<view class="ffffff contentradius mainpadding">
				<view class="flexcolumn">
					<view class="flexleft" style="align-items: flex-end;" v-if="dataAll.state==3">
						<view class="lan_text bold" style="font-size: 80rpx;height: 90rpx;">{{dataAll.result_score}}</view>
						<view class="lan_text bold titletext">分</view>
					</view>
					<!-- 包含简答题需要改卷 -->
					<view class="huang_text bold" style="font-size: 60rpx;" v-if="dataAll.state==2">改卷中</view>
					<view class="linebt"></view>
				</view>
				<view class="mainpadding_top radius" style="background-color: #f8f8fa;">
					<view class="flexaround pdl" v-if="dataAll.state==3">
						<view class="flexcolumn">
							<view class="xiaolan bold">{{dataAll.correct_num}}</view>
							<view class="hui_text margin_top2 main_size bold">答对</view>
						</view>
						<view class="flexcolumn">
							<view class="xiaohong bold">{{dataAll.wrong_num}}</view>
							<view class="hui_text margin_top2 main_size bold">答错</view>
						</view>
						<view class="flexcolumn">
							<view class="xiaohui bold">{{dataAll.notdone_num}}</view>
							<view class="hui_text margin_top2 main_size bold">未做</view>
						</view>
					</view>
					<view class="pdl margin_top flexbetween">
						<view class="hui_text main_size bold">题数</view>
						<view class="lan_text main_size bold">{{dataAll.total_num}}题</view>
					</view>
					<view class="pdl margin_top flexbetween" >
						<view class="hui_text main_size bold">满分</view>
						<view class="lan_text main_size bold">{{dataAll.total_score}}分</view>
					</view>
					<view class="pdl margin_top flexbetween">
						<view class="hui_text main_size bold">答题用时</view>
						<view class="lan_text main_size bold">{{dataAll.use_duration}}分钟</view>
					</view>
					<view class="margin_top flexbetween" v-if="dataAll.username">
						<view class="hui_text main_size bold">交卷老师</view>
						<view class="lan_text main_size bold">{{dataAll.username}}</view>
					</view>
				</view>
			</view>
		</view>
		<view class="posibottom flexbetween mainpadding" style="z-index: 10;" v-if="dataAll.state!=2">
			<view class="resetbtn" @click="homepage">返回首页</view>
			<view class="surebtn" @click="chakansj">查看试卷</view>
		</view>
		<view class="posibottom flexbetween mainpadding" style="z-index: 10;" v-if="dataAll.state==2">
			<view class="submitbtn" @click="homepage">返回首页</view>
		</view>
	</view>
</template>

<script>
	const httpRequest = require("@/common/httpRequest.js")
	export default {
		data() {
			return {
				education_lesson_id: "", //课程id
				student_examination_id: "", //测试记录id
				dataAll:{},
			}
		},
		onLoad(options) {
			this.education_lesson_id = options.education_lesson_id
			if (options.student_examination_id) {
				this.student_examination_id = options.student_examination_id
			}
			this.init()
		},
		methods: {
			init() {
				httpRequest.request('/api/examination/start_show', 'GET', {
					education_lesson_id: this.education_lesson_id,
					student_examination_id: this.student_examination_id
				}, false, false, true).then(res => {
					this.dataAll = res.data
				}).catch(err => {
					httpRequest.toast(err.msg);
				})
			},
			homepage(){
				uni.reLaunch({
					url:"/pages/index"
				})
			},
			chakansj(){
				let data = {
					education_lesson_id:this.education_lesson_id,
					student_examination_id:this.student_examination_id,
				}
				uni.navigateTo({
					url:"/pages_mine/chakansj?data=" + encodeURIComponent(JSON.stringify(data))
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.linebt {
		background-color: #e9f3fc;
		width: 80rpx;
		height: 10rpx;
		border-radius: 50rpx;
		margin-top: 40rpx;
	}

	.headbgc {
		background: linear-gradient(180deg, #3478F5 0%, #fafafa 100%);
		height: 400rpx;
		position: fixed;
		top: 0;
		left: 0;
		width: 100%;
	}

	.topradius {
		border-radius: 15rpx 15rpx 0 0;
		background-color: #f1f1f1;
		font-size: 30rpx;
	}

	.contentmsg {
		position: relative;
		z-index: 2;
	}

	.contentradius {
		border-radius: 0 0 15rpx 15rpx;
	}
</style>